<div class="admin-content" id="accordion">
	<div class="am-cf am-padding">
		<div class="am-fl am-cf">
			<strong class="am-text-primary am-text-lg">团信息</strong> / <small>Groups</small>
		</div>
	</div>

	<div class="am-panel-default" ng-repeat="productCategory in productCategorys">
		<div class="am-panel-hd">
			<h4 class="am-panel-title" data-am-collapse="{parent: '#accordion', target: '#do-not-say-{{$index}}'}">{{productCategory.description}}</h4>
		</div>

		<div id="do-not-say-{{$index}}" class="am-panel-collapse am-collapse">
			<div class="am-panel-bd">
				<div class="alert alert-info">
					<ul class="am-avg-sm-1 am-avg-md-2 am-avg-lg-3 am-margin gallery-list">
						<li data-ng-repeat="item in products[$index] | filter:filterProduct">
							<!-- 强行去边框 -->
							<div class="am-img-bdrs am-img-thumbnail" style="border: none;">
								<img data-am-offcanvas="{target: '#doc-oc-demo3'}" ng-click="getProduct(item.product.id)" class="am-img-thumbnail am-img-bdrs" ng-src="{{baseUrl+item.product.thumbId+formatImage}}" />
								<div class="gallery-list" style="padding-top: 3%;">
									<input readonly class="am-form-field" type="text" ng-model="description" ng-init="description=item.product.description" />
								</div>

								<div class="am-margin-vertical-sm" data-ng-repeat="group in item.groups track by $index">
									<a data-am-offcanvas="{target: '#group-detail'}" data-ng-click="goUpdate(group.id);"><i class="am-icon-pencil-square am-icon-sm"></i></a><span class="am-margin-horizontal"> <span data-ng-bind="group.personAmount"></span>人团 <span class="am-badge am-badge-danger am-round" data-ng-bind="group.version"></span></span>
									<div class="am-cf am-fr">
										<input class="am-margin-left-sm" switch-on-text="√" switch-off-text="×" ng-change="changeStatus(group.status,group.id)" bs-switch ng-model="group.status" type="checkbox" name="my-checkbox">
									</div>
								</div>
							</div>
							<div>
								<div>
									<!-- 增加  effect: 'push' 可以推动-->
									<i data-ng-click="add(item)" data-am-offcanvas="{target: '#product-detail'}" class="am-icon-plus am-btn am-btn-default am-btn-xl am-round"></i>
								</div>
							</div>
						</li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- =================================================================================================================== -->
<div id="doc-oc-demo3" name="" class="am-offcanvas" style="touch-action: pan-y; -webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">
	<div class="am-offcanvas-bar am-offcanvas-bar-flip am-offcanvas-bar-overlay">
		<!--content start  -->
		<div class="am-offcanvas-content">
			<div class="am-cf am-padding">
				<div class="am-fl am-cf">
					<strong class="am-text-primary am-text-lg">产品信息</strong> <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close="">×</a>
				</div>
			</div>

			<hr>

			<div class="am-g" ng-model="nproduct">
				<form name="formName">
					<div class="am-u-sm-12 am-u-md-4 am-u-md-push-8">
						<div class="am-panel am-panel-default">
							<div class="am-panel-bd">
								<div class="am-g">
									<div class="am-u-md-4">
										<img class="am-img-circle am-img-thumbnail" data-am-modal="{target: '#my-actions'}" ng-src="{{ nproduct.thumbId? baseUrl+nproduct.thumbId+formatImage : 'sad.png' }}" alt="" ng-click="pass(nproduct.thumbId)" name="thumb" />
									</div>
								</div>
							</div>
						</div>

						<div class="am-panel am-panel-default">
							<div class="am-panel-bd">
								<div class="alert alert-info">
									<ul class="am-avg-sm-4 am-avg-md-4 am-avg-lg-4 am-margin gallery-list">
										<li ng-repeat="image in images track by $index">
											<!-- 强行去边框 -->
											<div class="am-img-bdrs am-img-thumbnail" style="border: none;">
												<img required ng-click="pass(image)" data-am-modal="{target: '#my-actions'}" class="am-img-thumbnail am-img-bdrs" name="images" ng-src="{{  baseUrl+image+formatImage }}" />
											</div>
										</li>
									</ul>
								</div>
							</div>
						</div>

					</div>
					<!--表单验证  -->

					<div class="am-u-sm-12 am-u-md-8 am-u-md-pull-4">
						<div class="am-form am-form-horizontal">
							<div class="am-form-group">
								<label class="am-u-sm-3 am-form-label">产品描述</label>
								<div class="am-u-sm-9">
									<input required readonly ng-model="nproduct.description" placeholder="请输入产品描述" type="text">
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-3 am-form-label">价格</label>
								<div class="am-u-sm-9">
									<input readonly required ng-model="nproduct.price" placeholder="输入单价" type="number">
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-3 am-form-label">规格</label>
								<div class="am-u-sm-9">
									<input required readonly ng-model="nproduct.specification" placeholder="输入规格" type="text">
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-3 am-form-label">存货量</label>
								<div class="am-u-sm-9">
									<input readonly required data-ng-model="nproduct.amount" placeholder="输入货存量" type="number">
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-3 am-form-label">产品品类</label>
								<!--存储品类信息  -->
								<div class="am-u-sm-9">
									<!-- 初始化产品品类  -->
									<label ng-model="nproduct.category.id" ng-show=false></label> <input readonly ng-model="nproduct.category.description" readonly=true type="text">
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-3 am-form-label">备注</label>
								<div class="am-u-sm-9">
									<input readonly ng-model="nproduct.note" placeholder="输入产品备注" type="text">
								</div>
							</div>

						</div>
					</div>
				</form>
			</div>
			<button class="am-btn am-btn-primary doc-oc-js" data-rel="close">关闭侧边栏</button>
		</div>
		<script>
			$(function() {
				var id = '#doc-oc-demo3';
				var $myOc = $(id);
				$('.doc-oc-js').on('click', function() {
					$myOc.offCanvas($(this).data('rel'));
				});

				var productid = '#product-detail';
				var $myOcProduct = $(productid);
				$('.doc-oc-js').on('click', function() {
					$myOcProduct.offCanvas($(this).data('rel'));
				});

				var groupid = '#group-detail';
				var $myOcGroup = $(groupid);
				$('.doc-oc-js').on('click', function() {
					$myOcGroup.offCanvas($(this).data('rel'));
				});
			});
			var nowTemp = new Date();
			var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
			var $myStart2 = $('#birthday_input');
			var $myStart1 = $('#birthday_input1');

			var checkin2 = $myStart1.datepicker({
				onRender : function(date) {
					return date.valueOf() < now.valueOf() ? 'am-disabled' : '';
				}
			});

			var checkin = $myStart2.datepicker({
				onRender : function(date) {
					return date.valueOf() < now.valueOf() ? 'am-disabled' : '';
				}
			});
		</script>
	</div>
</div>
<!-- 修改详情侧边栏 -->
<div id="group-detail" name="" class="am-offcanvas" style="touch-action: pan-y; -webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">
	<div style="background: white; border: none;" class="am-offcanvas-bar am-offcanvas-bar-flip am-offcanvas-bar-overlay">
		<!--content start  -->
		<div class="am-u-sm-12">
			<div class="am-cf am-padding">
				<div class="am-fl am-cf">
					<strong class="am-text-primary am-text-lg">修改团信息</strong> <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close="">×</a>
				</div>
			</div>

			<hr>

			<div class="am-g" ng-model="ngroup">
				<form name="formName2">

					<!--表单验证  -->

					<div class="am-u-sm-12 am-u-md-8">
						<div class="am-form am-form-horizontal">

							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">团购价格</label>
								<div class="am-u-sm-12 am-u-md-9">
									<input required data-ng-model="updateGroup.personPrice" placeholder="请输入团购价格" type="number">
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">开团描述</label>
								<div class="am-u-sm-12 am-u-md-9">
									<textarea readonly data-ng-model="updateGroup.description" placeholder="请输入团描述" rows="3"></textarea>
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">截止日期</label>
								<div class="am-u-sm-12 am-u-md-9 am-input-group">
									<input id="birthday_input" type="text" class="am-form-field " placeholder="{{ updateGroup.deadline | date: 'yyyy-MM-dd' }}">
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">人数</label>
								<div class="am-u-sm-12 am-u-md-9">
									<input required readonly ng-model="updateGroup.personAmount" placeholder="请输入人数" type="text">
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">存货</label>
								<div class="am-u-sm-12 am-u-md-9">
									<input required ng-model="updateGroup.balance" placeholder="货存量" type="number">
								</div>
							</div>
							
							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">版本号</label>
								<div class="am-u-sm-12 am-u-md-9">
									<input required ng-model="updateGroup.version"  type="number" >
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">产品</label>
								<!--存储品类信息  -->
								<div class="am-u-sm-12 am-u-md-9">
									<!-- 初始化产品品类  -->
									<input readonly ng-model="updateGroup.product.description" readonly=true type="text">
								</div>
							</div>

							<!-- <div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">产品品类</label>
								存储品类信息 
								<div class="am-u-sm-12 am-u-md-9">
									初始化产品品类 
									<input readonly ng-model="ngroup.category.description" readonly=true type="text">
								</div>
							</div> -->


							<div class="am-form-group">
								<div class="am-u-sm-9 am-u-sm-push-3">
									<button data-ng-disabled="formName2.$invalid" type="button" class="am-btn am-btn-primary" ng-click="update(updateGroup,formName2.$pristine)">保存修改</button>
								</div>
							</div>

						</div>
					</div>
				</form>
			</div>
			<button class="am-btn am-btn-primary doc-oc-js" data-rel="close">关闭侧边栏</button>
		</div>
	</div>
</div>

<!-- 	新增团详情侧边栏 -->
<div id="product-detail" name="" class="am-offcanvas" style="touch-action: pan-y; -webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">
	<div style="background: white; border: none;" class="am-offcanvas-bar am-offcanvas-bar-flip am-offcanvas-bar-overlay">
		<!--content start  -->
		<div class="am-u-sm-12">
			<div class="am-cf am-padding">
				<div class="am-fl am-cf">
					<strong class="am-text-primary am-text-lg">团信息</strong> <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close="">×</a>
				</div>
			</div>

			<hr>

			<div class="am-g" ng-model="ngroup">
				<form name="formName">

					<!--表单验证  -->

					<div class="am-u-sm-12 am-u-md-8">
						<div class="am-form am-form-horizontal">

							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">团购价格</label>
								<div class="am-u-sm-12 am-u-md-9">
									<input required data-ng-model="ngroup.personPrice" placeholder="请输入团购价格" type="number">
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">开团描述</label>
								<div class="am-u-sm-12 am-u-md-9">
									<textarea required data-ng-model="ngroup.description" placeholder="请输入团描述" rows="3"></textarea>
								</div>
							</div>
							
							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">截止日期</label>
								<div class="am-u-sm-12 am-u-md-9 am-input-group am-datepicker-date">
									<input datepicker id="birthday_input1" type="text" class="am-form-field " placeholder="请点击选择" data-ng-model="ngroup.dateline">
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">人数</label>
								<div class="am-u-sm-12 am-u-md-9">
									<input required ng-model="ngroup.personAmount" placeholder="请输入人数" type="text">
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">存货</label>
								<div class="am-u-sm-12 am-u-md-9">
									<input required ng-model="ngroup.balance" placeholder="货存量" type="number">
								</div>
							</div>

							<div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">产品</label>
								<!--存储品类信息  -->
								<div class="am-u-sm-12 am-u-md-9">
									<!-- 初始化产品品类  -->
									<input readonly ng-model="nproduct.description" readonly=true type="text">
								</div>
							</div>

							<!-- <div class="am-form-group">
								<label class="am-u-sm-12 am-u-md-3 am-form-label">产品品类</label>
								存储品类信息 
								<div class="am-u-sm-12 am-u-md-9">
									初始化产品品类 
									<input readonly ng-model="ngroup.category.description" readonly=true type="text">
								</div>
							</div> -->


							<div class="am-form-group">
								<div class="am-u-sm-9 am-u-sm-push-3">
									<button data-ng-disabled="formName.$invalid" type="button" class="am-btn am-btn-primary" ng-click="submitdata(ngroup,formName.$pristine)">保存</button>
								</div>
							</div>

						</div>
					</div>
				</form>
			</div>
			<button class="am-btn am-btn-primary doc-oc-js" data-rel="close">关闭侧边栏</button>
		</div>
	</div>
</div>
